Fixed logging to show an 'alert' on the console only when applicable