Implements issue #561