Bugfixes in line with API