Attempt at fixing OSX event loop