use typeof on outer scope variables