Fixed bug in Layer.save()