midi sustain not working

I recorded piano using the sustain pedal. From the beginning everything was ok, but after a while suddenly the sustain disappeared from the first notes of the midi-track. Bringing up the List Editor I see the Control event CC64 with value 127 followed by the first notes. I’ve been trying lots of different ways of making it to work but no matter what I do the first notes is played without sustain.

However, if I is looping the song and it’s starting automatically again then the notes is played with sustain.

Would be grateful for some help on this

EDIT: I’m using Cubase 6