Much more robust performance when called from terminal with parameters