algorithm frame bug fix