fixed onBeat() lua crash