Fixed bug when callback is called multiple times