Fix Undefined Variable Errors