Fixed not sending application disconnection event, fixes #50