update manual insert to guard against nil