Ensuring that listening_ports results are unique

Fixing #329