fixed loads of bugs