Fix range exception