Fix invalid encoded space and return 0 in scanhash on comms error.