added extra checks + bugfixed rootdircache