fix bug in source on global var for $endpoint