fixed the pointer bug