fixed appDir assignment after use