fix a lot of bugs part 1