Fixed the bug that was not counting the blocks correctly