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

You can't call an undefined variable safely, but it is safe to reference an undefined property of an object.