Please review the attached patch which addresses the following issues:
These changes were successfully compiled on a Fedora 27 machine with the following packages: