Fixed bugs in text file