fix signed/unsigned mismatch in compare