Fixed a bug where bindings first assigned inside a compound statement at top level would be lexically scoped to that statement.

Top level bindings are now defined at the module's beginning.