Fix length check (via Jamie Foster)