Improve Lua instance caching

Fixes #85