Add an extra check and log message