loads of bugfixes