fixed some errors preventing compile
Merge remote-tracking branch 'upstream/master'