fixed improper events consuming code
fixed compilation error