fixes setEvents method

calling setEvents method threw ReferenceError: calendar is not defined