Add explicit pointer castings to remove gcc warnings