fix up bugs