Fixed AccessViolationException in VS2012.