[1.6.x] Fixed incorrect type for max_length.

Backport of 3b60ffa334 from master