rewrite bin script