added missing refcount stuff in runtime