Added logging and alert for error