Hello andrei.t,
Welcome to our forum and thanks for contacting us with your question!
It's highly possible it's a bug. Would be much helpful if you reproduce your problem with some example data, then I will be able to start debugging the case and find a possible workaround for that. You can start here:
https://jsfiddle.net/BlackLabel/0pbeym97/ and send me a forked link.
Looking forward to your response,
Kind Regards!