Added error function in delegate