Support for writing masked arrays and added ma test