[OE-3742] Fixed for adding optional elements in correct order