add pub upgrade support

@tapted @devoncarew

Add support for pub upgrade, fix errors while running pub.