pad: Fix refcount bug by unreffing the correct variable