fix upgrade and address other comments