Fix convertHEX function