bugfix: dict will unref again when called lock/unlock twice
add test case for bugfix: unref dict