Fix an infinite loop while updating frames