some bugs fixed.
Merge pull request #297 from Diullei/master

some bugs fixed.