Fixing error reporting on local unlink, added some checks