Add maxlength/minlength and fix 'serialising'