added file test and fixed some bugs
added file test
cosmetic changes