added more recovery code