Made the parsing methods less prone to thrown ClassCastExceptions.