fixed the pointer problem