diff --git a/src/__mocks__/net.ts b/src/__mocks__/net.ts
index 08e50b1..ca51127 100644
--- a/src/__mocks__/net.ts
+++ b/src/__mocks__/net.ts
@@ -53,10 +53,11 @@ export class Socket extends EventEmitter {
 		}, 3)
 	}
 	public write(buff: Buffer, encoding = 'utf8'): void {
-		expect(this.expectedWrites).not.toHaveLength(0)
+		if (this.expectedWrites.length === 0) throw new Error('Got unexpected write')
 
 		const w = this.expectedWrites.shift()
 		if (w) {
+			// eslint-disable-next-line jest/no-standalone-expect
 			expect(buff).toEqual(w.call)
 			this.emit('data', w.response)
 		}
diff --git a/src/hyperdeck.ts b/src/hyperdeck.ts
index f68e8ea..b6fefd4 100644
--- a/src/hyperdeck.ts
+++ b/src/hyperdeck.ts
@@ -184,7 +184,12 @@ export class Hyperdeck extends EventEmitter {
 						.then(() => {
 							this._logDebug('ping: setting up')
 							this._pingInterval = setInterval(() => {
-								if (this.connected) this._performPing().catch((e) => this.emit('error', e))
+								if (this.connected)
+									this._performPing().catch((e) => {
+										if (this._connectionActive) {
+											this.emit('error', e)
+										}
+									})
 							}, this._pingPeriod)
 						})
 						.then(() => c)
@@ -199,7 +204,9 @@ export class Hyperdeck extends EventEmitter {
 			.catch((e) => {
 				this._connected = false
 				this.socket.destroy()
-				this.emit('error', 'connection failed', e)
+				if (this._connectionActive) {
+					this.emit('error', 'connection failed', e)
+				}
 				this._log('connection failed', e)
 
 				this._triggerRetryConnection()