update with fixes contributed by Bernhard M. Wiedemann