I had a pretty harsh bug just now, an "Unhandled Exception Error". As a programmer myself I know those are the word kinds of exception errors. I'm not really clear what caused it, since I was really into my game, but it seemed to occur right at the moment I had used an alt-move of a collection of ships onto a freshly built command station. The command station wasn't done building itself, and in the selection group I was moving there were (as I recall) two Science Labs, an Advanced Science Lab, a Remote Builder, a Mobile Repair Ship, about fifteen tugs, an a small collection of bombers, frigates, fighters, and tachyon mini-fighters.
My best guess is that it took my action as a "Hey Mobile Builder help build this station!" command, which didn't work and wasn't handled, causing the exception. But, I have no idea how your code works so that's just a guess. I hope this has enough information! Maybe you already fixed it; I'm not exactly using the latest version here...