fixing premature end of file error