Load correct product breadcrumb from front page in Magento

Change in app\code\core\Mage\Catalog\controllers\ProductController.php

After:

$categoryId = (int) $this->getRequest()->getParam('category', false);

add code:

if($categoryId == 0){
   $_product = Mage::getModel('catalog/product')->load($productId);
   $cat_ids = $_product->getCategoryIds();
   $categoryId = $cat_ids[0];
  }