fix the on / off called in a callback function