critical section smooth cost bug fix