add replaceAt method