fixed a few bugs and changed default format to json