a lot of bugs fixed