Correctly breaks on invalid input