Fixed merge layer insertion to happen at the right position in the layer list.