started fixing memory leaks in move back and forth for migrep