Fix crash when dragging&dropping layers

Fixes issue #64