Fix nasty bug in migrate command