checking values of ad['id'] and duration before display