Fixes for https://github.com/olevole/cbsd/issues/25. Reported and fixed by: kev009