Library paths & C compiler fixes!

This is a grab bag of all the things required to get this working on OS X 10.9 - also, a pretttttty terrifying safety fix.