fix charge function