fix an exception when deleting a module