Fix for Error: undefined local variable or method scope