Fix sortable layers. Fixes #363.