fix bug: comparisons of negative numbers give wrong answers