Fix #385 - improve server/lib/filesystem.js