console.log in the wrong place