Bug fix with checking MaxLength