Fix erratic behavior with frames