fix bug with adding layer to the same parent

addLayer will always place layer at the top even if layer already
belongs to the same parent