Fix the arrays branch.
A bunch of fixes that somehow did not end up in previous commits.