Bugfix found by Jan Blechta.