Fix compilation

I forked your repo and found it didn't compile on Mac OS X. You may want to integrate this fix into your code.