Fix calling the callback multiple times