Fix scope in client functions