new error handling added