Fix issues found during code review