Fix bug where non-hex values raised exception and some client bugs