fix bugs detected by scrutinizer
add license file