Fix class cast exception.