Fixed the segue bug. The problem was that the API request was called asynchronously, and sometimes this meant that stopData was not yet defined. Added a spinlock immediately before making the request that waits until stopData is defined.