fix errors when apps try to use unlink on directories