Fix bug with hex length checking