Some fixes after the last refactoring