Fix copy/pasto introduced in previous commit.
Remove irrelevant comment.
Move variable declaration to the top, declare it global before defining. Fixes #3090