Create listing with multiple categories on front-end

This seems to work, but when I select a 2nd category it does not take it and updates the field but returns the previous single selection. Also going from a subcategory to a parent category deletes the previous selection.
I only have this problem on the front-end.