technically it was wrong all the time but it only showed up with newer visual c++ compiler.
Also moved some code out of the connection files to their own files.