Fixed the variable pointer issues