Improve compatibility with OS X