Fix some upgrade errors