Fix handling of Vars. Corrected contract for datatype ancestor env