Bug fix for array key index