fix an issue with off() and updated tests