adding some sanity check according to visual studio 2013 static code analysis