Fix class casting when processing original metadata annotations