Fix some errors on local testing.

I find some errors of tests when I try to run them on local environment.
I've fixed some issues related to errors, and please merge them if you are OK.