Fix passing pointer bug