Plenty of bugfixes