fix undefined by try catch