Compile fixes on RHEL5/Fedora, see #541