Fix usage of unitialized local var (backport from trunk)