Change handling of wrong input to throw Exception.