Fixed bugs in length tests