fixed bug with resourcereplace