fixes to array handling for older bash shells running as sh