AUI-1577 Check length correctly