bug fix (pre-declare ondrain)