Fix infinite recursion when encoding collection with embedded null