fixed some init bugs