fixed bug in getClosestEvents