Handle empty subjects properly.

fix #586