compile fixes for OS X 10.7 and 10.8 as discussed

Implements #1