fixed compilation errors on *nix platforms.
mac build, wip.