Fixed bug when screenshot capture fails