add `mode384 = !!mode384;` at the beginning of this function and just use `if (mode384) {` here and below