console.log shows correct result