Fix bug when you can't render a screenshot because of headless mode
Fixing bug #52