fixed comparison to be unsigned