fixed issue with composing element, function remembering the previous
added element.