Fixed null pointer exception in AG_EventLoop