typo fix
bug fix: 1/n in d_beta
add cache