Possibly more robust filename resolution.