modified migrep.c