Switch to console.error instead of alert