catch invalid range error