Events tests

Fixed some errors in the events client. wrote events test and fixed some
other errors