Fix callback creation and returning