changed replacement method