fix a couple of bugs preventing building under OS X Mavericks