Fix for using undefined variable