added conditinaol around upgrade