Fix "no such file" and "permission denied" errors