fixed bug with status flags and rereading of files