calculate func fix