ParMETIS_V3_PartKway is not getting the vertices!

Hello,
I have a FORTRAN routine that calls ParMETIS_V3_PartKway. It worked fine for about a decade now. Recently I started using it is in a different cluster. It has different compilers and (latest) parmetis version. When I print some arrays (e.g. 'xadj' and 'tpwgts' below) in my fortran routine before passing those to parmetis routine, it writes correct values. However, the error tells me that parmetis routine reads those as empty arrays.

Here is the parmetis routine call:

print*,'xadj',xadj,myproc
print*,'tpwgts',tpwgts,myproc

call ParMETIS_V3_PartKway(nepl, xadj, adj, vwgt, junk4,&
wtFlag, style, ncon, npes, tpwgts, ubvec,&
options, junk3, pet, MPI_COMM_WORLD)

The error messages I get are below:
******************************************
*** glibc detected *** ../bin/RUN: double free or corruption (!prev): 0x088b0990 ***
CALLING METIS 3.1!
xadj 1 2 5 8 10 12 15 18 20 22 25 28 29 31 34 37 40 43 46 49 52 55 58 61 63 0
xadj 1 3 6 9 12 15 18 21 24 27 30 33 35 37 40 43 46 49 52 55 58 61 64 67 69 1
xadj 1 3 6 9 12 15 18 21 24 27 30 33 35 37 40 43 46 49 52 55 58 61 64 67 69 2
tpwgts 0.25000000 0.25000000 0.25000000 0.25000000 0
tpwgts 0.25000000 0.25000000 0.25000000 0.25000000 2
xadj 1 3 6 9 12 15 18 21 24 27 30 33 35 36 39 42 44 46 49 52 54 56 59 62 63 3
tpwgts 0.25000000 0.25000000 0.25000000 0.25000000 3
PARMETIS ERROR: The sum of tpwgts for constraint #0 is not 1.0
tpwgts 0.25000000 0.25000000 0.25000000 0.25000000 1
PARMETIS ERROR: Poor initial vertex distribution. Processor 2 has no vertices assigned to it!
PARMETIS ERROR: Poor initial vertex distribution. Processor 1 has no vertices assigned to it!
PARMETIS ERROR: Poor initial vertex distribution. Processor 3 has no vertices assigned to it!
ParMetis done!
********************************

Clearly 'xadj' and 'tpwgts' are not empty, but parmetis routine thinks otherwise!

This is how I have some of the arrays defined and allocated:

integer, ALLOCATABLE:: adj(:), xadj(:), vwgt(:),pet(:)
real*4, ALLOCATABLE:: tpwgts(:), ubvec(:)

ALLOCATE( xadj(nec+1) ) !nec = Number of elements in each processor
ALLOCATE( adj(nfc*nec) ) !nfc = Number of faces in each element
ALLOCATE (vwgt(nec))
ALLOCATE (pet(nec))
ALLOCATE (tpwgts(ncon*npes))
ALLOCATE (ubvec(ncon))

style = 1
ncon = 1
options(1) = 0
wtFlag = 0

do i = 1,nec
vwgt(i) = 1
enddo

How to fix the problem?
Thank you in advance.
makbar

RE: What are the values for nepl?

What are the values for nepl? This is an array of size #npes+1

RE: My nepl values are: 1, 25,

My nepl values are: 1, 25, 49, 73, and 97. I have 96 elements and I am using 4 processors.
I have printed a few more items copy-pasted below. Hopefully it will help to identify the sourse(s) of error. Thank you again!
PS: I inherited the code. Did not write by myself!

*** glibc detected *** ../bin/RUN: double free or corruption (!prev): 0x09f5d990 ***
CALLING METIS 3.1!
*** glibc detected *** ../bin/RUN: malloc(): memory corruption: 0x09f51820 ***
adj 2 3 14 1 4 15 2 5 3 6 4 7 18 5 8 19 6 9 7 10 8 22 9 11 12 23 10 11 14 25 15 13 2 3 16 14 17 28 15 18 29 16 19 17 6 7 20 18 21 32 19 22 33 20 23 21 10 11 24 22 36 23 0 0 0 0 0 0 0 0 0 0 0
npes 4 0
adj 13 26 27 38 25 28 39 26 29 27 16 17 30 28 31 42 29 32 43 30 33 31 20 21 34 32 35 46 33 36 47 34 35 24 38 49 39 37 26 27 40 38 41 52 39 42 53 40 43 41 30 31 44 42 45 56 43 46 57 44 47 45 34 35 48 46 60 47 0 0 0 0 1
npes 4 1
nepl 1 25 49 73 97 1
adj 61 74 75 86 73 76 87 74 77 75 64 78 76 65 79 90 77 80 91 78 81 79 68 69 82 80 83 94 81 84 95 82 83 72 86 87 85 74 75 88 86 89 87 90 88 91 89 78 79 92 90 93 91 94 92 95 93 82 83 96 94 95 0 0 0 0 0 0 0 0 0 0 3
npes 4 3
nepl 1 25 49 73 97 3
nepl 1 25 49 73 97 0
PARMETIS ERROR: The sum of tpwgts for constraint #0 is not 1.0
PARMETIS ERROR: Poor initial vertex distribution. Processor 1 has no vertices assigned to it!
adj 37 50 51 62 49 52 63 50 53 51 40 41 54 52 55 66 53 56 67 54 57 55 44 58 56 45 59 70 57 60 71 58 59 48 62 73 63 61 50 51 64 62 65 76 63 66 77 64 67 65 54 68 66 55 69 80 67 70 81 68 71 69 58 72 70 59 84 71 0 0 0 0 2
npes 4 2
nepl 1 25 49 73 97 2
PARMETIS ERROR: Poor initial vertex distribution. Processor 2 has no vertices assigned to it!
PARMETIS ERROR: Poor initial vertex distribution. Processor 3 has no vertices assigned to it!