Minor fixes and better support for RHEL 5