fix callback logic