test mapping document creation and fixed some bugs