Some fixes previous to refactor