fix render function