fix undefined exception