Some fixes for GCC 4.2, and for Java on Mac