Better error trapping.