Fix for port allocation errors during tests