Fix bugs and get flux BC's working from Lua