solving pointer problem