modified to use pointer->long to retrieve auto allocated value