minor patches and clean ups