Fixed bugs in createBlocks