Fixed exception on invalid chars.