function if there is invalid range given for loop
        uint256 _wei2stb = 10**14; 
        uint _pb = (icoEndBlock - icoStartBlock)/4; 
        uint _bonus;

        
        uint256 _mintAmount = 0;
        for (uint256 i = _from; i < _to; i++) {
            if (donations[i].exchangedOrRefunded) continue;  
            if (donations[i].block < icoStartBlock + _pb) _bonus = 6;  
            else if (donations[i].block >= icoStartBlock + _pb && donations[i].block < icoStartBlock + 2*_pb) _bonus = 4;  
            else if (donations[i].block >= icoStartBlock + 2*_pb && donations[i].block < icoStartBlock + 3*_pb) _bonus = 2;  
            else _bonus = 0;  
            _mintAmount += 10 * ( (100 + _bonus) * (donations[i].ethAmount / _wei2stb) / 100);
        }