Now matches the original scripts behavior both locally and using ssh.