Fix one small bug; revert temporary fix that was masking the class cast
exception