fixed bug with empty layers (and folders!)