added check on if the passed file name is nil