fixed a small logic bug with my previous commit.