Fix compilation on OS X 10.9 (clang)

Also fixes #45.

Tested only on OS X 10.9.