debugging a pointer problem