you're declaring the `buffer` variable twice. `if`s don't have block scoping in JS.