fix bug which prevent bag files from being read when the filename has been changed