Refactoring a test
Add map_matrix and fix type bug