[master] Fix TS for replication to tape
The recent change to improve the throttling mechanism of pre-staging induced a side-effect when replicating to tape, and no tasks were created. This MR fixes this problem.
In addition, get rid of query loops to BK when a list of event types or productions is provided (as Oracle improved the execution plan).
Few very minor fixes for scripts.