Speedup for non-windows, fixes.

Set up a TPP with these scripts, seemed to need some small fixes.

See commit comments for details.