Event handling fixed. #123
Event encoding fixed. #123