Improve range checking for editor