Fix bug which tried to use SID in global context