fixed bug on single replacement