Added regression test to fix memory leak introduced by wrong reference count.