function _checkCap (address addr) internal returns (uint) {
    if (!whitelistIsActive) return contributionCaps[0];
    _checkWhitelistContract(addr);
    var c = whitelist[addr];
    if (!c.authorized) return 0;
    if (nextCapTime>0 && block.timestamp>nextCapTime) {
      contributionCaps = nextContributionCaps;
      nextCapTime = 0;
    }
    if (c.cap<contributionCaps.length) return contributionCaps[c.cap];
    return c.cap; 
  }