some fixes for GCC, does not yet compile
revert VC++ 2008 fixes because they break GCC somehow