Re-synchronization for issue 517

As my branch was out of synch. and it were merge conflicts i re-created new branch and added a new pull request for this issue.