modified to work with OSX 10.7. should fix #1