add try-except for render function