fixed string error when error object is undefined