more error handling added into app