Fixed mem leak in render()