fixed bug in reading format