Modifications to make sure it also works under vs2012.