Fix bug occurring when converting invalid input.