Bugfixes to the previous commit.