Opponents of Ahmadinejad make gains in local elections