Fixed bugs with fileid values when opening new files.