hand cherry pick of 7f58309f6db304193ab0475c7fc58e842604ee78

bug fix in block handling