more robust collection script