adapted to pull request #12