Cleanups in DefaultClient

Made the code less prone to inconsistencies.