Added prof_on_disconnect hook
Moved shutdown hook, so disconnect hook runs first