Fixed merge algorithm for <command> elements