fix undefined data issue