Addressing bug raised in http://forum.jquery.com/topic/replacewith-bug