fix bug with hex_to_int; remove unused function