added simple debug and fixed issue with detecting note off.