Fix compile / undeclared variable errors.