Declare variable 'ffi' in global scope

Likewise here.