Flatten tags and categories lists. Fixes #741.