add shebang and fix code