Fixed the render function