Fixed various build issues due to merging in new APIs from master