Several simple fixes

I'll consider re-implementing the pull request #12 someday. Let's do some simple stuffs first:)