Fixed bug with granularity not casting to int.