has been fixed to call the callback function correctly