fix using undefined variable