fixed function for making full path to file instead of dir