Fixed the check for the end of the current transfer