Fix safety check when using window.console and switch to console.warn for warnings