Fixes for error callback handling

Jira Issue: WP-1251
Merge pull request #23 from habibvirji/WP-1251-bugFix

Fixes for error callback handling