Added Jarkko Kniivilä's tweaks to make scripts run more easily on FreeBSD.