This pull request solves issue #674, see it for details.