Added error handling to read-string