Update code of rendering relative image path according to Noah and Su's comments