fixing dirname to file