fix issue where wrong number of kernel computations were performed. And wrong number of threads blocks were launched for some cases