add tests for locals clearing