Fixed some bugs related to formatting