onDisable handling to make sure no memory leaks occur