fixed signed / unsigned comparison bug