made sure it compiles using vs2012 and removed some warnings