Patched to compile on Solaris.