working - (infinity loop on readline() error)
fixed infinite loop