find some tiny bugs and finish file operation.