Fix bug #1165