handle failure cases more better