checking for success & error properly