build fixes

some minor fixes for older C compilers and glibc