Fixed an error with undefined variable