fix error handling of render method