Fixed an issue with having too many locals in self-reference section.
Added handling of metatables with __tostring method.
Added support for metatables with __serialize method.