more fixes found with gdb