Fix errors mentioned in the code review