Fix pointer issues