Avoid console.log from printing twice