function buyTokens() internal {
        uint256 tokens = msg.value.div(tokenPrice);
        uint256 balance = keeppetToken.balanceOf(this);
        tokens = tokens.mul(countMultiplyBonus(msg.value));

        if (balance < tokens) {
            uint256 tempTokenPrice = msg.value.div(tokens); 
            uint256 toReturn = tempTokenPrice.mul(tokens.sub(balance)); 
            sendTokens(balance, msg.value - toReturn);
            msg.sender.transfer(toReturn);
            return;
        }
        sendTokens(tokens, msg.value);
    }