Yet more bugfixes for refactoring process