Bugfixes to last commit