Events bugfixes plus complete tests