pmperson fixed few bugs in migration routine