Introduce teardown hook for modules; fix mcstatus bug