bugfixes and eventhandler setup