fixed app logout. added purge param to specify whether to kill entire session or just user session vars.