add trigger to unload event