lots and lots of bugfixes!