small refactorings, looking for a bug