added error handling to notification loop.