Improve joinsplit diagnostics
I don't advocate merging this for the hotfix release (to fix#1779) but this PR can be used to diagnose the real issue and should be merged ASAP afterward.
~I still need to add tests for `last()` and `element()` though.~ Done.