lots of bugfixes regarding events and structure