upstream fixes and local fixes
wheeeeee