Fix checks for ranges