fix undefined i