Fix bug in previous pull request #1. Unfoutunately it was not right.