fixes for 64-bit gcc, other minor cleanups