Fixed changes to global being persistent across reboots

Tooks some messing around, and a new local term variable instead of
replacing api.term on api.init(), but moving api.env = {...} into
api.init() solved the issue where changes in _G from in the emulator
would remain after a reboot.