refactor getPtr