fixed schema type handling for maps and pairs, added tests, closes #954

probably for @rwcarlsen to review.