Fix potential NPE when extracting files