Loads of small bugfixes