bugfix on unload