fixed errors for new trigger function