fixed bugs with granularity