better handling callback before return