Fix bugs in newrest
Fix bug in update rests