Added Handling error function