Move masterport directive to [main] block to allow to set agent port at the same time

Move masterport directive to [main] block to allow to set agent port at the same time.