fix a bug in load()
small modifications
add tests for dump() and load()