Fix bug #586