Grazie Oregon, non mi ero accorta che la funzione restituiva un integer invece che un long!
Risolto...