Added check for illegal characters