Leave event + bug fixes