fixed reference file checking