Fix range check to allow zero and one