fix array writes, add some tests for reverse, etc