Fixed auto assignment of primary category

Still will fail if all categories are removed from the relationship by
the admin. Since it will not call "post_remove".