Remove extra lcmaps_term calls (already called by the lcmaps_return_* functions). Add explicit call of va_end. Add (commented-out) calls to setvbuf to change to unbuffered output.