Compatibility Errors

Fixed errors caused by potentially unset variables.