Added some more empty vector/map checks to deal with the case that no jpeg files exist in the target folder.