Changed the for loop in slave.js and master.js

Changed the for....in loop with normal for loop in slave.js and master.js. Some more instances left in master.js.