Fix script to log better.