Bugfixes from code review