fixed bug with fstream constructor