Fixed compile and some warnings in MSVS