cherry-pick cloudnull's promon patches from master