Fixes problems with output scalar file handling, namespace warnings when compiling with gcc-3.x (x>0), and some other bugs.