Fix #561

See commit.