Added extra check to remove error log