Fixed bug with undefined variable.