Fix issue with undefined variable