Bug fixes to previous commit.