Fixed bug in string termination
Fixed ifstream error check