Bug fix
More bug fixes in the off() function.