LOTS of bugfixes