Change test for illegal characters; the previous one wouldn't have worked very well.