fix bugs of solving phi and theta
add perplexity