Bugfixes for version 3