fix handling of missing flats