move exit statement inside callback to ensure execution