Fixed logic error in previous upgrade script.