fixed logic for range data check, still not running