The statements being executed in the OnEvent clauses are causing EGL to become out of sync.
Verify the usage of statements/function calls within the OnEvent block statements.