removed refcount field from Mat; that helped to find and eliminate some memory leaks. perf tests should probably pass now