Fixed foreign_interface when the argument is both input and output
Added some tests about foreign interface and dictionaries