Fix a bug with array increasement