insert handles undefined correctly