Fix some build and runtime errors and warnings (on OS X 10.9-DP5 and Xcode 5-DP5, at least)