Fix memory leak, add license, create test.html to reproduce errors