posix build fixes and bug fixes