added fail event handler