fix motion calculation