fix pointer bug