wrap id handling in a helper to avoid index exception