ENH: Keep list of next modules when inserting a module into the module history

Fixes http://na-mic.org/Mantis/view.php?id=3533