more work on CRM-12463
Merge pull request #612 from kurund/CRM-12463-fixes

more work on CRM-12463