fix undefined issue