Tweak core.serialize

This adds proper support for nested tables and improves performance a bit.
Add strict module

Also fix leaking globals found by it.