pin: Replace invalid chars with _ in file names.

This needs to be merged for #259 to work.