fixed lot of bugs