OS X Mavericks compatibility

(Benedict's code, closes #3)