Fix defects found at code review #2