Add gitignore and fix small bugs