fixed sortLayer()