Update modulemanager.inc to a50ec5e5.
Fix module reference being reset too early when deleting a module.
Add debug logging messages when deleting modules and adding to index.