Fix 'lets-assume-that-the-mask-is-a-subfolder' problem and other issues commented by Daniel