fixes suggested by p-e-w in pull request