Fixed issues #532, #533 and #534 for VS2012 and 2010.