Fix to  avoid consecutive array resize