it's copied from below. the same code is used in open_dcd_read