Bugfixes for setting up events