Fixed null-pointer bug with my previous commit.