fixed bugs, got vs2010 debug building. not tested.