Fixed Undefined Variable Bug