Defining this plugin as a LayoutAlgorithm and writting to the result variable was causing corrupted values.