piccoli bug fix e lieve refactoring