Fix a sum of bugs