better range checking for a single element