Properly convert data to hex