fixed humongous bug caused by 'wrong' order of FFI declarations