myriad bugfixes after refactoring