#660 fixed error during template serialization to json because of cyclic reference in the blocks array