optimized read_labels for speed