added ctx to render function