Fixed some bugs on win8