fix issue with undefined variable