fixed a bug in coarse-grained dynamic scheme, add CacheDebug debug flag