As far as I understand, command.remain is an array and Boolean([]) === true. Not sure we are checking for the right thing here and on the next line.