undo last 2 commits, #20

not happy with this
another fix... #20

for 31eaf8e540133424061ea199bced5e4d0aeeec07 when $NMIMAGES is not
defined