Error in replacing