added gitignore, fix some bugs