Made code portable for VS2013 (VC12)