Fixing error with constrainMotion flags and optimized-away assertion