Fix issues with Array access and add tests.