Sustain is messed up

My setup is this: A Yamaha KX8 running MIDI to my Scarlett 18i20, which is running USB to my PC.

The other night I opened up Cubase, created a MIDI track and recorded a song (using Kontakt 5 as the instrument). Everything sounded fine, and I replayed it several times, each time sounding fine. I saved the project and closed Cubase.
Today I opened Cubase up to export the song, and suddenly the first part of the song has completely lost the sustain. If I go into the note editor and move all the notes to a later position in the song it fixes it, but it creates other sustain issues in later parts of the song.
Has anyone else run into this issue?