fixed #2502

@vigsterkr for #2502: 
with memcheck, some of the examples used to take ~180 seconds on my machine. I modified them a little so that now they take <10 seconds each with memcheck.