various improvements, modifies a unit test which was missing a bug