Fixing range position bug (shifted by 1)