Fixed some bug with file states