Fix bugs in loadtest.js