attempted to fix possible race condition in getevents