Fixed check for field error in upgrade script