Fixed some bugs for win7.