Fixed ClassCastExceptions