Fix pointer bug and change function name