Some final bugfixes