finish render function