minimized version, no errors detected by gdb so far.