Fix module instances not being deleted on stop