changed by return a pointer directly and added a test for this.