- Fixed bug in set_global
- Added various sanity checks
- Added regression test