Guard more against bad data and set test to better reflect incomplete data. Should fix test-trepanpl test