fixed significant bugs