Fixed app referenced before assignment