Solved bug with events