Fixed build problems on MacOS. Thanks to Greg.