Fix issues raised in code review