error handling added to q