fix error when there's no useful png and rm temp dirs when error