fix bugs on $final behavior
add license header to debug files
ignore those /tern-port files