Backport of #3196

Issue with iterability of axes arguments [backport to 1.4.x]