Fixed loads of functionality breaking bugs