add extra check to logfileopen