fix bug with python replace not working correct (wasn't setting parent element)