Fixing some bugs and adding support for MPI interoperability