fixed renderHTML function