Make snapshot and module targets more robust