fixes for CRM-14004, duplicate memberships

----------------------------------------
* CRM-14004: Membership export includes multiple copies of the same membership
  http://issues.civicrm.org/jira/browse/CRM-14004
fix mis-spellings & undeclared variables
extra setting test - hookt pu
Merge pull request #2257 from kurund/CRM-14004

fixes for CRM-14004, duplicate memberships
Merge pull request #2285 from eileenmcnaughton/extra-test

Extra test, a couple of tidy-ups