Fix warnings and a test failure exposed on CentOS 6.3.