fixed bug introduced in 48ff4846006151555ea75d695d09991f513f5288 generated all
output files with the same name. We now use port number and output file number
to ensure different names.