Fix for Firefox image replacement bug