Fix reference counting bugs. Correcly handle composition strings.