diff --git a/CRM/Grant/BAO/GrantProgram.php b/CRM/Grant/BAO/GrantProgram.php
index 8cdd8f959f0a2834fc639c28c7f10efb9a6e2666..90d5faa5133be34458e4fbf98f42710f0a39ce63 100755
--- a/CRM/Grant/BAO/GrantProgram.php
+++ b/CRM/Grant/BAO/GrantProgram.php
@@ -335,7 +335,7 @@ WHERE civicrm_contact.id = $id ";
         $sendTemplateParams['toName'] = $displayName;
         $sendTemplateParams['toEmail'] = $email;
         $sendTemplateParams['autoSubmitted'] = TRUE;
-        CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams);
+        CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
         if ($grantId && $status) {
           $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
           $activityType = CRM_Core_PseudoConstant::activityType();
diff --git a/CRM/Grant/DAO/Grant.php b/CRM/Grant/DAO/Grant.php
index 5b80f12ca75e0f6e1f47fbbbb08ae8de5c452575..2258379e4c889b69f0c201bbcccd662c09ceb95d 100644
--- a/CRM/Grant/DAO/Grant.php
+++ b/CRM/Grant/DAO/Grant.php
@@ -49,6 +49,13 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO
    * @static
    */
   static $_fields = null;
+  /**
+   * static instance to hold the keys used in $_fields for each field.
+   *
+   * @var array
+   * @static
+   */
+  static $_fieldKeys = null;
   /**
    * static instance to hold the FK relationships
    *
@@ -214,9 +221,9 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO
   {
     if (!(self::$_links)) {
       self::$_links = array(
-        'contact_id' => 'civicrm_contact:id',
-        'grant_program_id' => 'civicrm_grant_program:id',
-        'financial_type_id' => 'civicrm_financial_type:id',
+        new CRM_Core_EntityReference(self::getTableName() , 'contact_id', 'civicrm_contact', 'id') ,
+        new CRM_Core_EntityReference(self::getTableName() , 'grant_program_id', 'civicrm_grant_program', 'id') ,
+        new CRM_Core_EntityReference(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id') ,
       );
     }
     return self::$_links;
@@ -351,10 +358,16 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO
         'currency' => array(
           'name' => 'currency',
           'type' => CRM_Utils_Type::T_STRING,
-          'title' => ts('Currency') ,
+          'title' => ts('Grant Currency') ,
           'required' => true,
           'maxlength' => 3,
           'size' => CRM_Utils_Type::FOUR,
+          'pseudoconstant' => array(
+            'table' => 'civicrm_currency',
+            'keyColumn' => 'name',
+            'labelColumn' => 'full_name',
+            'nameColumn' => 'numeric_code',
+          )
         ) ,
         'rationale' => array(
           'name' => 'rationale',
@@ -378,6 +391,9 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO
           'headerPattern' => '',
           'dataPattern' => '',
           'export' => false,
+          'pseudoconstant' => array(
+            'optionGroupName' => 'grant_status',
+          )
         ) ,
         'grant_rejected_reason_id' => array(
           'name' => 'grant_rejected_reason_id',
@@ -415,13 +431,43 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO
           'name' => 'financial_type_id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Financial Type') ,
-          'default' => 'UL',
+          'default' => 'NULL',
           'FKClassName' => 'CRM_Financial_DAO_FinancialType',
         ) ,
       );
     }
     return self::$_fields;
   }
+  /**
+   * Returns an array containing, for each field, the arary key used for that
+   * field in self::$_fields.
+   *
+   * @access public
+   * @return array
+   */
+  static function &fieldKeys()
+  {
+    if (!(self::$_fieldKeys)) {
+      self::$_fieldKeys = array(
+        'id' => 'grant_id',
+        'contact_id' => 'grant_contact_id',
+        'application_received_date' => 'application_received_date',
+        'decision_date' => 'decision_date',
+        'money_transfer_date' => 'money_transfer_date',
+        'grant_due_date' => 'grant_due_date',
+        'grant_report_received' => 'grant_report_received',
+        'grant_type_id' => 'grant_type_id',
+        'amount_total' => 'amount_total',
+        'amount_requested' => 'amount_requested',
+        'amount_granted' => 'amount_granted',
+        'currency' => 'currency',
+        'rationale' => 'rationale',
+        'status_id' => 'grant_status_id',
+        'financial_type_id' => 'financial_type_id',
+      );
+    }
+    return self::$_fieldKeys;
+  }
   /**
    * returns the names of this table
    *
diff --git a/CRM/Grant/Form/Task/GrantPayment.php b/CRM/Grant/Form/Task/GrantPayment.php
index ba8fdf544f8112b1f36b07586e6c64df076f70bb..a0f723ba1042ebf30246f3cc2ce41ef17d6b4f64 100755
--- a/CRM/Grant/Form/Task/GrantPayment.php
+++ b/CRM/Grant/Form/Task/GrantPayment.php
@@ -276,7 +276,6 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
       $downloadNamePDF .= '.pdf';
       $fileName = CRM_Utils_File::makeFileName( $downloadNamePDF );
       $files[] = $fileName = CRM_Grant_BAO_GrantPayment::makePDF($fileName, $grantPayment );
-      $counter++;
     }
     $downloadNameCSV = check_plain('grantPayment');
     $downloadNameCSV .= '_'.date('Ymdhis');