A few bugfixes for the previous commit.