added license, improved error handling in test case