added logging
fixed some invalidate performance issues;
Merge branch 'master' into invalidate_optimization