Fixed proper applicationRoot for single-mode apps, added context vars
Fixed bug in getApplicationRoot