Fix Locals analysis

Nested Functions support was clumsy,
This should fix #186