Fixed crash on exit due to a slot