fixed the load and unload function