fix onbefore warning