fixes (courtsey of Dave Golland) for Mac