added licenses and updated from upstream 40b314894c7de615b09d633774f9146e4b097b02