Fix several error messages and compiler segmentation fault.