Fixing bug in callback returning null and not data