strengthened the code to better handle the error during the product
query.