Fix the error in the block to chunk mathematical expression

Signed-off-by: Irmo van den Berge <bergerkiller@gmail.com>
Merge pull request #2244 from bergerkiller/master

Fix the error in the block to chunk mathematical expression
Various fixes and improvements

Signed-off-by: Chris Sanders <zidane@outlook.com>