bug fixed when using granularity