Added condition when there are no blocks