Added check to ensure "pieces" value is correctly formatted.