fixed issues except #7 mentnd at http://is.gd/snwm_issues
resync upstream on Thu May  8 07:08:58 GMT 2014