Fix range calculations when using 0