fixed validation order of operations bug with min and max length