incorporate fixes from Pin