fixed tests, improved and corrected event handling