Fix a lot of bug