Test fixes, better JSON/BSON handling