make use of Statement::apply()
Merge pull request #1820 from WalterBright/refactorApply

make use of Statement::apply()