Fix invalid references