fixed bug to replace images