fixed using undefined variable