added test and fixed getBlocks