fixes disconnected port errors and cleans up console.logs