fix undefined error