bugfix for migrations (introduced some minor bugs in tests)