Variables changed

from %d to %ld
and int to long int