fixed some notices and a couple bad variable names