bug fix for label matrix