Render only when we have a valid context

Attempt to fix #759 

@ThomasMaxwell  Can you try this change?