Fixed some undefined variable warnings
Fixed missing variable (#1397)