RHEL5 support

Some mods to make this compile on RHEL5.