added unload api handling that works on linux, file events work differently between mac os x and linux