Scala migration: compile OK except cyclic