added debug and runWhenFinished options