Instead of just calling hasFnAttribute(), call getFnAttribute() and check that it is set to "true".
It seems that the "backchain" attribute does not have to be checked this way, since it is simply present or non-present. Would this be preferrable perhaps also for "packed-stack" (instead of this patch)?