add defaultType support in Next(), add template helper function