bugfixes after analysis