Fixed a bug with comparison operators.

Also added tests for what I changed, which pass locally.