Fixed issue #2007. Tests are missing yet.