fix undefined next