Fix addClassName when passing invalid classes. This fixes issue #364