fix for v4.40 test failure on older perls

it seems the test  for flatten method fails on older perls.
the pull req fixes it.