fix bug in test_{length_,tomaxdims}