Add safety checks for duplicate or misaligned labels