CHanged console.write line to debug.log