In practice if you really care about fixing bugs/cleaning things up the thing that works best is sneaking that into feature work somehow.