added error handling of invalid products