Bernhards changes to fix typeerrors.