Fix class cast