Add gitignore and fix a small bug.