Omitted error logging in main - fixed