Range checking problem