Revised hex string conversion