repaired appcontext and tests