Fix range() and document it