Added check for writable directory usage