Fixed excecution order, fixes #16
Fix event count condition