BUG: correct handling of multiple classes