Magari c'è un errore nel resto del codice, qui mi sembra tutto a posto