fix bugs in formatting