read line
add some error handling