Fix issues raised in comments