Merge latest upstream code into github fork