fixed compilation with VS.
code simplifications.