modifications to make sure msvc 12 builds and a bug fix