Added check to ensure maxlength property is set.