added file checking mecanism