Change console.alert to use console.error