Fixing some minor bugs in previous commit.