Fixed loads of bugs