Checking for possible errors and logging them