Fixed the spaces bug in filepath and added file number tracking in log