Improved construction of ids of elements in compose text.