Portability update and bug fixes.