several bugfixes, added a lot of debug code which has to be removed once the application runs stable.