How to ensure a correct number of trials