Added liscense and fix on array references