adding length checking in string scanners