def unhex(x):
    """Ensure hexidecimal strings are converted to decimal form"""
    if x == '':
        return '0'
    elif x.startswith('0x'):
        return str(int(x, base=16))
    else:
        return x