Fix bugs found by EPV. Add license file.