several fixes for migration