Fix reversed sign comparison