Merge upstream

Add changes from @klang