fixed bug where array modifications weren't returned due to non-pointer usage in loop