my various modifications to get this working on my mac