fixed several bugs, removed useless logging