missing +1 in #frames as frame[0] is not counted in lua tables