fixed apparent bugs