fixed bugs.

fixed bugs for #2.