made fixes to the pull request #277