fix writing both kind of figures

split figures into 2 kinds text and binary

should fixes #107