Fix bugs in createTrack method