modified to compile on MBA, 10.9.4, with gcc-4.8