code cleanup
don't crash on unload