Missed part of mint-master merge
Some cleanup and fix for categories not staying selected.
Filesystem access, partially taken from #1428