Three fixes for segfaults, discovered while running with many UEs. See commit messages for more details.