Fixed wild pointer bug