Fix read and add checks for user input.