Correctly protect newly created folders (see #6432)