fixed issue with leave events not firing correctly